import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class CustomCupertinoAlertDialog extends StatelessWidget {
  final Widget title;
  final Widget content;
  final List<Widget> actions;
  final Color backgroundColor;

  const CustomCupertinoAlertDialog({
    Key? key,
    required this.title,
    required this.content,
    required this.actions,
    this.backgroundColor = Colors.white,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Dialog(
      backgroundColor: backgroundColor,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(12.0),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Padding(
            padding: const EdgeInsets.all(16.0).copyWith(bottom: 0),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                title,
                SizedBox(height: 21),
                content,
              ],
            ),
          ),
          Divider(
            color: Color(0xffDDDDDD),
            height: 1,
          ),
          Row(
              children: List.generate(
            actions.length * 2 - 1,
            (index) => index % 2 == 0
                ? Expanded(child: actions[index ~/ 2])
                : SizedBox(
                    height: 51,
                    child: VerticalDivider(
                      width: 1,
                      color: Color(0xffDDDDDD),
                    ),
                  ),
          )),
        ],
      ),
    );
  }
}
